RDKCOM-5619: RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework - #396
Open
sherik-sensin wants to merge 1 commit into
Open
RDKCOM-5619: RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework#396sherik-sensin wants to merge 1 commit into
sherik-sensin wants to merge 1 commit into
Conversation
|
📋 PR Format Reminder
Expected: |
Reason for change: Marking table should be created dynamically based on the virtual interface marking entry from WanManager.
Add L3 marking based on WanManager marking entries.
Test Procedure: Performed firewall Sanity test.
Risks: None.
Signed-off-by: Sherik Sensin A <sherik.a@telekom-digital.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces WAN Manager–driven QoS marking rule generation in the firewall subsystem, emitting DSCP and CLASSIFY rules into the iptables mangle table for both IPv4 and IPv6 when the WAN service is ready.
Changes:
- Adds a new
add_qos_skb_mark(FILE*, int family)API (guarded byFEATURE_WANMGR_L2_MARKING) to build DSCP/CLASSIFY rules based on WanManager TR-181 marking entries. - Invokes the new QoS rule emission from the IPv4 mangle table setup and from the IPv6 filter path.
- Introduces WanManager TR-181 parameter name constants and protocol-specific rule generation (DNS/NTP/HTTP/VoIP/IPTV/IGMP/MLD/etc.).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| source/firewall/firewall.h | Declares the new add_qos_skb_mark API behind FEATURE_WANMGR_L2_MARKING. |
| source/firewall/firewall.c | Implements WanManager-based DSCP/CLASSIFY rule generation and hooks it into IPv4 mangle table preparation. |
| source/firewall/firewall_ipv6.c | Hooks the new rule generation into the IPv6 rule generation path. |
Suppressed comments (4)
source/firewall/firewall.c:5504
- strncpy(..., sizeof(dest)) may leave SKBMark without a null terminator when the source is long. Prefer a guaranteed-terminated copy.
strncpy(SKBMark, acTmpReturnValue, sizeof(SKBMark));
source/firewall/firewall.c:5517
- strncpy(..., sizeof(dest)) may leave DSCPMark without a null terminator when the source is long. Prefer a guaranteed-terminated copy.
strncpy(DSCPMark, acTmpReturnValue, sizeof(DSCPMark));
source/firewall/firewall.c:5530
- strncpy(..., sizeof(dest)) may leave MarkingName without a null terminator when the source is long, which can break the subsequent strcmp chain. Prefer a guaranteed-terminated copy.
strncpy(MarkingName, acTmpReturnValue, sizeof(MarkingName));
source/firewall/firewall.c:5545
- strncpy(..., sizeof(dest)) may leave WanVIfName without a null terminator when the source is long, which can result in malformed iptables rules. Prefer a guaranteed-terminated copy.
strncpy(WanVIfName, acTmpReturnValue, sizeof(WanVIfName));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return -1; | ||
| } | ||
|
|
||
| strncpy(WanVIfMarkingEntry, acTmpReturnValue, sizeof(WanVIfMarkingEntry)); |
Comment on lines
+5402
to
+5406
| memset(acTmpReturnValue, 0, sizeof(acTmpReturnValue)); | ||
| if (ANSC_STATUS_FAILURE == RdkBus_GetParamValues(WAN_COMPONENT_NAME, WAN_DBUS_PATH, WAN_IF_COUNT, acTmpReturnValue)) | ||
| { | ||
| printf("[%s][%d]Failed to get WAN interface count\n", __FUNCTION__, __LINE__); | ||
| return -1; |
|
|
||
| strncpy(SKBMark, acTmpReturnValue, sizeof(SKBMark)); | ||
|
|
||
| /* Get EthernetPriorityMark */ |
Comment on lines
+5558
to
+5561
| fprintf(mangle_fp, "-A POSTROUTING -j DSCP -p udp --dport %d -o %s --set-dscp-class %s\n", dest_port, current_wan_ifname, DSCPMark); | ||
| fprintf(mangle_fp, "-A POSTROUTING -j DSCP -p tcp --dport %d -o %s --set-dscp-class %s\n", dest_port, current_wan_ifname, DSCPMark); | ||
| fprintf(mangle_fp, "-A POSTROUTING -j CLASSIFY -p udp --dport %d -o %s --set-class 0:%s\n", dest_port, current_wan_ifname, SKBMark); | ||
| fprintf(mangle_fp, "-A POSTROUTING -j CLASSIFY -p tcp --dport %d -o %s --set-class 0:%s\n", dest_port, current_wan_ifname, SKBMark); |
Comment on lines
+5573
to
+5574
| fprintf(mangle_fp, "-A POSTROUTING -p tcp --dport %d -m dscp --dscp-class cs3 -o %s -j DSCP --set-dscp-class %s\n", HTTP_PORT, current_wan_ifname, DSCPMark); | ||
| fprintf(mangle_fp, "-A POSTROUTING -p tcp --dport %d -m dscp --dscp-class %s -j CLASSIFY --set-class 0:%s\n", HTTP_PORT, DSCPMark, SKBMark); |
sherik-sensin
force-pushed
the
RDKBNETWOR-99_qos
branch
from
August 5, 2026 11:34
2d8f2be to
9803290
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.